def max(x,y):
    if(x>y):
        return x
    else:
        return y

def max_sub_array_of_size_k(k, arr):
    max_sum = 0
    _sum = 0
    start = 0
    for end in range(len(arr)):
        _sum += arr[end]
        if(end>=(k-1)):
            max_sum = max(_sum,max_sum)
            _sum -= arr[start]
            start +=1
    return max_sum

def main():
    max_sum = max_sub_array_of_size_k(3,[2, 1, 5, 1, 3, 2])
    print("output:"+str(max_sum))
    max_sum = max_sub_array_of_size_k(2, [2, 3, 4, 1, 5])
    print("output:"+str(max_sum))

main()  
    
